﻿<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
/**
 * 判断是否实名在his系统的表SF_BRXXK中是否已存在记录
 *
 */

	Message msg = new Message();
		try {
			String cardNumber = input.getDesc("cardNumber","");  //身份证号
			if(cardNumber==null || (cardNumber.trim()).length()==0) {
				return;
			}
			
		// 根据身份证号我的预约
		Connection connection = null;
		PreparedStatement  statement = null;
		try {
			connection = getConn();
			String sql="select patid as patid,blh as blh,hzxm as hzxm from SF_BRXXK a where sfzh = ? " ;

			statement = connection.prepareStatement(sql); 
			statement.setString(1, cardNumber);
			ResultSet rs = statement.executeQuery();
			List list = new ArrayList();
			Map m= null;
			while(rs.next()){
				 m = new HashMap();
				 m.put("patid",rs.getString("patid"));
				 m.put("blh",rs.getString("blh"));
				 m.put("hzxm",rs.getString("hzxm"));
				 list.add(m);	 				 				 				 				 
      }
    	if(list != null && list.size() != 0) {
					msg.put("errcode",0);
					msg.put("data",list);
			} else {
					msg.put("errcode",30041);
					msg.put("errmsg","暂无数据");
			}
      msg.put("data",list);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
					if (statement != null)
						statement.close(); 
					if (connection != null)
						connection.close(); 
				} catch (Exception e) {
					statement = null;
					connection = null;
					e.printStackTrace();
				}
		}
		
    }catch (Exception e){
	   	msg.put("errcode",FAILURE);
    }
		out.println(msg);
	
%>